/*
 * @Author: GuitarXiaohe && 2205227953@qq.com
 * @Date: 2024-01-17 09:38:45
 * @LastEditors: GuitarXiaohe && 2205227953@qq.com
 * @LastEditTime: 2024-01-19 18:25:22
 * @FilePath: /umi/src/wrappers/auth.jsx
 * @Description:此页面相当于路由守卫
 * QQ:2205227953,邮箱:2205227953@qq.com
 * Copyright (c) 2024 by GuitarXiaohe, All Rights Reserved.
 */
import { Navigate } from "react-router-dom";
import { getToken } from "@/utils/auth";
import { Outlet, useDispatch, connect } from "umi";
const Auth = () => {
  console.log("我是wrappers-auth");
  const isLogin = getToken();
  if (isLogin) {
    return <Outlet />;
  } else {
    return <Navigate to="/login" />;
  }
};

export default connect((state) => ({ user: state.user }))(Auth);
